import request from '@/utils/request'

export function paginate(form, page, page_size) {
  return request({
    url: '/api/pajx/tea/paginate',
    method: 'post',
    data: {
      page_num: page,
      page_size: page_size,
      hxy_scl_id: form.hxy_scl_id,
      hxy_gra_id: form.hxy_gra_id,
      hxy_cls_id: form.hxy_cls_id,
      scl_role: form.scl_role,
      keyword: form.keyword
    }
  })
}

export function save(form) {
  return request({
    url: '/api/pajx/tea/save',
    method: 'post',
    data: {
      hxy_scl_id: form.hxy_scl_id,
      tea_name: form.tea_name,
      tea_phone: form.tea_phone,
      scl_role: form.scl_role,
      tea_sex: form.tea_sex,
      rec_att_msg_flag: form.rec_att_msg_flag
    }
  })
}

export function update(form) {
  return request({
    url: '/api/pajx/tea/update',
    method: 'post',
    data: {
      tea_id: form.tea_id,
      hxy_scl_id: form.hxy_scl_id,
      tea_name: form.tea_name,
      tea_phone: form.tea_phone,
      scl_role: form.scl_role,
      tea_sex: form.tea_sex,
      rec_att_msg_flag: form.rec_att_msg_flag
    }
  })
}

export function sync(hxy_scl_id) {
  return request({
    url: '/api/pajx/tea/sync',
    method: 'post',
    data: {
      hxy_scl_id: hxy_scl_id
    }
  })
}

export function teaJobNow(hxy_tea_id) {
  return request({
    url: '/api/pajx/tea/job/now',
    method: 'post',
    data: {
      hxy_tea_id: hxy_tea_id
    }
  })
}

export function teaJobHistory(hxy_tea_id) {
  return request({
    url: '/api/pajx/tea/job/history',
    method: 'post',
    data: {
      hxy_tea_id: hxy_tea_id
    }
  })
}

export function jobDelete(tea_job_id) {
  return request({
    url: '/api/pajx/tea/job/delete',
    method: 'post',
    data: {
      tea_job_id: tea_job_id
    }
  })
}

export function jobSave(form) {
  return request({
    url: '/api/pajx/tea/job/save',
    method: 'post',
    data: {
      hxy_scl_id: form.hxy_scl_id,
      hxy_tea_id: form.hxy_tea_id,
      hxy_cls_id: form.hxy_cls_id,
      subject_name: form.subject_name,
      role_flag: form.role_flag,
      status_flag: form.status_flag
    }
  })
}